What do I need to call instead of 'nativemodules'? I get null.
import React, { useState } from 'react';
import { View, Text, StyleSheet, Pressable, ImageBackground, TextInput,NativeModules, AppRegistry } from 'react-native';
import Logo from './component/Logo';
import bgImage from '../../images/login.jpg';
import logoImage from '../../images/logo_login.png';
import Icon from 'react-native-vector-icons/FontAwesome';
// android:windowSoftInputMode="adjustPan"
const Login = (props) => {
const [setting, setSetting] = useState('nothing');
const setKeyboardSetting = (setting) => {
var AndroidKeyboardAdjust = NativeModules.AndroidKeyboardAdjust;
setSetting(setting);
switch (setting) {
case 'nothing':
AndroidKeyboardAdjust.setAdjustNothing();
break;
case 'pan':
AndroidKeyboardAdjust.setAdjustPan();
break;
case 'resize':
AndroidKeyboardAdjust.setAdjustResize();
break;
case 'unspecified':
AndroidKeyboardAdjust.setAdjustUnspecified();
break;
}
}
return(
<ImageBackground resizeMode='cover' source={bgImage} style={[styles.centeredView]}>
<Icon name="rotate-left" onPress={()=>{props.navigation.navigate('Home')}} size={25} color="#376ba3" style={{position:'absolute', top:30, left:20}} />
<View style={styles.formView}>
<View style={styles.logoDiv} color={['white','black']}>
<Logo logoSource={logoImage} logoStyles={styles.logo} />
</View>
<View style={styles.formMain}>
<View style={styles.inputMain}>
<Icon name="user" size={20} style={{padding: 10}} color={'#94dcf7'} />
<TextInput color={'#94dcf7'} onPressIn={()=>{setKeyboardSetting('nothing')}} style={styles.textInput} keyboardType='email-address' placeholderTextColor={'#35d4f4'} placeholder="E-Mail" />
</View>
<View style={styles.inputMain}>
<Icon name="user" size={20} style={{padding: 10}} color={'#94dcf7'}/>
<TextInput placeholderTextColor='#35d4f4' onPressIn={()=>{setKeyboardSetting('pan')}} style={styles.textInput} secureTextEntry={true} placeholder="Parola" />
</View>
<View style={styles.buttonMain}>
<Pressable
style={[styles.button]}
onPress={()=>{props.navigation.navigate('Home')}}
>
<Text style={styles.textStyle}>Giriş</Text>
</Pressable>
<Pressable
style={{ width:'80%',
padding:5,
backgroundColor: "#fff"}}
onPress={()=>{props.navigation.navigate('Home')}}
>
<Text style={{ color: "#184575",
textAlign: "center", fontSize:13, textDecorationLine:'underline'}}>Parolanı mı unuttun?</Text>
</Pressable>
</View>
</View>
</View>
</ImageBackground>
);
};
const styles = StyleSheet.create({
logoDiv:{
position:'relative',
top:-100,
width:130,
height:130,
borderBottomLeftRadius:100,
borderBottomRightRadius:100,
borderTopLeftRadius:100,
borderTopRightRadius:100,
backgroundColor:'#adedfb'
},
centeredView: {
width:'100%',
height:'100%',
justifyContent: "center",
alignItems: "center"
},
formView:{
width:'80%',
height:'50%',
borderColor:'rgb(180, 199, 232)',
borderWidth:1,
borderTopLeftRadius: 0,
borderTopRightRadius: 0,
borderBottomRightRadius: 0,
borderBottomLeftRadius:0,
backgroundColor: "white",
borderRadius: 20,
padding: 35,
alignItems: "center",
shadowColor: "#000",
shadowOffset: {
width: 50,
height: 2
},
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5,
position:'relative',
top:-50
},
formMain:{
width:'100%',
height:'90%',
top:90,
alignItems:'center',
position:'absolute'
},
textInput:{
borderBottomWidth:1,
borderBottomColor:'#35d4f4',
flex: 1,
paddingTop: 10,
paddingRight: 10,
paddingBottom: 10,
paddingLeft: 0
},
inputMain:{
flex: 0.2,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fff'
},
buttonMain:{
flex: 0.5,
width:'100%',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fff'
},
button: {
width:'80%',
elevation: 2,
padding:5,
backgroundColor: "#2196F3",
marginBottom:10
},
textStyle: {
color: "white",
fontWeight: "bold",
textAlign: "center"
}
});
export default Login;