Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Open react-native-paper Modal from another component

$
0
0

I have a stack navigator with Button in Appbar.Header for opening modal in file stack.tsx:

export const StackNavigator = () => {return (<Stack.Navigator       ...<Appbar.Header><Appbar.Content title={<MaterialCommunityIcons onPress={OPEN_MODAL_FROM_HERE}/>              ...</Appbar.Header>       ...<Stack.Screen name="Search" component={BottomTabs}/>...)}

BottomTabs Search tab (search.tsx) contains react-native-paper modal:

const SearchScreen = (props) => {  const [visible, setVisible] = React.useState(false);  const hideModal = () => setVisible(false);  const showModal = () => setVisible(true);return (<Provider><FlatList .../><Portal><Modal visible={visible} onDismiss={hideModal}></Modal></Portal></Provider>...)}

How can I do it?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>