Родная база и модал не работают в React Native - PullRequest
0 голосов
/ 08 июля 2019

Есть ли конфликт с нативной базой и реактивно-нативно-модальной? Я не могу заставить мой модал показывать контент. Мне было интересно, если это потому, что тег контейнера нативной базы.

Код: https://snack.expo.io/rJbAI_Cxr

1 Ответ

0 голосов
/ 09 июля 2019

Вы также можете использовать Modal из собственного компонента реагировать, нет необходимости использовать стороннюю библиотеку.

import {Modal} from 'react-native';


constructor(props) {
        super(props);
        this.state = { 
          modalVisibility: false,
    };

  ShowModalFunction(visible) {
    this.setState({ modalVisibility: visible });
}



                       <Modal
                        transparent={true}
                        animationType={"slide"}
                        visible={this.state.modalVisibility}
                        onRequestClose={() => { this.ShowModalFunction(!this.state.modalVisibility) }} >


            <View style={{ flex:1, justifyContent: 'center', alignItems: 'center' }}>

            <View style={styles.ModalInsideView}>

            <Text style={{color:'white',fontSize:14,fontWeight:'700'}}>Hello </Text>
            </View>
        </View>
        </Modal>

const styles = StyleSheet.create({        
ModalInsideView:{

  justifyContent: 'center',
  alignItems: 'center', 
  backgroundColor : "#00BCD4", 
  height: 245 ,
  width: '90%',
  borderRadius:10,
  borderWidth: 1,
  borderColor: '#fff'

},


});

Попробуйте, если вы столкнулись с проблемой в этом, дайте мне знать.

...