doomsower / react-native-modal-popover

React-Native pure JS popover that uses Modal
MIT License
322 stars 45 forks source link

how to use Popover alone? it's props visible do not work when use it alone! #7

Closed ding-love-yu closed 6 years ago

ding-love-yu commented 6 years ago

//here is my code i use Popover alone but the visible prop don't work!And i can't see it on my device!!! import React from 'react'; import { Button, StyleSheet, Text, View } from 'react-native'; import Popover, { PopoverTouchable } from 'react-native-modal-popover';

const styles = StyleSheet.create({ app: { ...StyleSheet.absoluteFillObject, alignItems: 'center', justifyContent: 'center', backgroundColor: '#c2ffd2', flex:1, }, content: { padding: 16, backgroundColor: 'pink', borderRadius: 8, }, arrow: { borderTopColor: 'pink', }, background: { backgroundColor: 'rgba(0, 0, 255, 0.5)' }, });

const App = () => (

Hello from inside popover!

);

export default App;

doomsower commented 6 years ago

Popover is meant to be used as controlled component, visible should be a state. Check out https://github.com/doomsower/react-native-modal-popover/blob/master/example/src/App2.js for example