React Native - Android position absolute buttons are untappable - react-native

I have a react native component that handles comunication between two peers using WebRTC.
Everything works perfectly on ios but on android the buttons are unclickable and i am pretty sure its because of the position:absolute, the buttons rendering somewhere behind a element and because of that they are untappable.
My question is ... what am i doing wrong? Why are they rendering but they are untappable on android?
The buttons are: End call positioned center bottom and switch camera positioned right bottom.
PS: I removed most of the component logic as it was irelevant to the question.
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { RTCView } from 'react-native-webrtc';
import WebSocketWrapper from '../components/generic/WebSocketWrapper/WebSocketWrapper';
import { Image, StyleSheet, View, Text, Platform, ActivityIndicator, Dimensions } from 'react-native';
import RNSecureStorage, { ACCESSIBLE } from 'rn-secure-storage';
import WebRtcPeer from 'react-native-kurento-utils';
import { COLORS } from '../styles/colors';
import { SafeAreaView } from 'react-navigation';
import axios from 'axios';
import Toast from 'react-native-root-toast';
import Icon from 'react-native-vector-icons/MaterialIcons';
import IconIonicons from 'react-native-vector-icons/Ionicons';
import { TouchableOpacity } from 'react-native-gesture-handler';
import logger from '#/logging.service';
import utils from '#/utils.service';
const BTN_CIRCLE_SIZE = 60;
const ICON_CIRCLE_SIZE = BTN_CIRCLE_SIZE / 2;
const styles = StyleSheet.create({
rtcViewsContainer: {},
remoteView: {
alignSelf: 'center',
top: 0,
right: 0,
bottom: 0,
left: 0,
backgroundColor: '#000000'
},
selfView: {
position: 'absolute',
alignSelf: 'flex-start',
width: 150,
height: 150,
left: 16,
bottom: 32,
borderWidth: 0.5
},
textContainer: {
flex: 1,
padding: 32,
width: '100%',
alignItems: 'center',
justifyContent: 'center'
},
introductionText: {
justifyContent: 'center',
alignItems: 'center',
fontSize: 13,
lineHeight: 22,
textAlign: 'center'
},
logo: {
alignSelf: 'center',
height: 70,
width: 150
},
logoContainer: {
height: 70,
position: 'absolute',
top: 0,
left: 0,
right: 0,
justifyContent: 'center',
alignItems: 'center'
},
endCallIconContainer: {
position: 'absolute',
zIndex: 100,
bottom: 32,
width: BTN_CIRCLE_SIZE,
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row'
},
endCallIconTouchable: {
width: BTN_CIRCLE_SIZE,
height: BTN_CIRCLE_SIZE,
borderRadius: BTN_CIRCLE_SIZE / 2,
alignSelf: 'center',
zIndex: 110,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'red'
},
switchCameraIconTouchable: {
width: BTN_CIRCLE_SIZE,
height: BTN_CIRCLE_SIZE,
borderRadius: BTN_CIRCLE_SIZE / 2,
alignSelf: 'flex-end',
zIndex: 110,
justifyContent: 'center',
alignItems: 'center'
},
switchCameraIcon: {
width: BTN_CIRCLE_SIZE,
height: BTN_CIRCLE_SIZE
},
endCallIcon: {
alignSelf: 'center'
}
});
export default class VideoCallIdentification extends Component {
static navigationOptions = {
header: null
};
displayRTCViews() {
return !!(this.state.remoteURL && this.state.videoURL);
}
getText() {
if (this.state.CALL_STATE === this.CALL_STATES.FINISHED_CALL) {
return 'Please wait ...';
} else if (this.state.REGISTERED_STATE === this.CALL_STATES.REGISTERED) {
return 'An agent will be with you soon. You will be prompted to give access to your microphone and camera in order for the video call to proceed!';
}
}
componentWillUnmount() {
this.stopCommunication();
}
getRemoveViewDimensions() {
return {
width: Dimensions.get('window').width,
height: Dimensions.get('window').height
};
}
onSocketError(e) {
logger.log('!!!!!!!!!!!!!!! Socket Erorr!', e);
utils.toast('An unexpected error has ocurred!');
this.stopWebRtc();
this.props.navigation.navigate('CompleteAccountPage');
}
getEndCallBarSize() {
return {
left: Dimensions.get('window').width / 2 - BTN_CIRCLE_SIZE / 2,
height: BTN_CIRCLE_SIZE
};
}
getSwitchCameraBarSize() {
return {
right: 32,
height: BTN_CIRCLE_SIZE
};
}
changeCamera() {
this.webRtcConnection.toggleCamera();
}
render() {
return (
<View
style={{ marginTop: 0, paddingLeft: 0, paddingRight: 0, marginBottom: 0, flex: 1, width: '100%', ...this.getRemoveViewDimensions() }}
containerStyle={{ flex: 1, width: '100%', ...this.getRemoveViewDimensions() }}
>
<SafeAreaView style={{ ...this.getRemoveViewDimensions(), position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>
{this.displayRTCViews() ? (
<View>
<View style={{ ...styles.rtcViewsContainer, ...this.getRemoveViewDimensions() }}>
<RTCView streamURL={this.state.remoteURL} style={{ ...styles.remoteView, ...this.getRemoveViewDimensions() }} />
<RTCView streamURL={this.state.videoURL} style={styles.selfView} />
</View>
<View style={{ ...styles.endCallIconContainer, ...this.getEndCallBarSize() }}>
<TouchableOpacity style={styles.endCallIconTouchable} onPress={() => this.stopCommunication(true).bind(this)}>
<Icon style={styles.endCallIcon} size={ICON_CIRCLE_SIZE} name="call-end" color="#ffffff" />
</TouchableOpacity>
</View>
<View style={{ ...styles.endCallIconContainer, ...this.getSwitchCameraBarSize() }}>
<TouchableOpacity style={styles.switchCameraIconTouchable} onPress={() => this.changeCamera(true)}>
<IconIonicons style={styles.endCallIcon} size={BTN_CIRCLE_SIZE} name="ios-reverse-camera" color="#ffffff" />
</TouchableOpacity>
</View>
</View>
) : (
<View style={styles.textContainer}>
<View style={styles.logoContainer}>
<Image source={require('../assets/images/logoAndNameColored.png')} style={styles.logo} resizeMode="contain" />
</View>
<Text style={styles.introductionText}>{this.getText()}</Text>
<ActivityIndicator style={{ marginTop: 22 }} size="large" color={COLORS.APP_PURPLE} />
</View>
)}
<WebSocketWrapper
ref={ref => {
if (!this.state.socket) {
this.setState({ socket: ref });
}
}}
onError={this.onSocketError.bind(this)}
onOpen={this.onSocketOpen.bind(this)}
url={this.state.socketUrl}
onMessage={this.onmessage.bind(this)}
/>
</SafeAreaView>
</View>
);
}
}
VideoCallIdentification.propTypes = {
navigation: PropTypes.object
};

Related

react-native-awesome-gallery shows only one image without gesture possible

related to : https://github.com/Flair-Dev/react-native-awesome-gallery
I tried many things, but nothing is working.
I made the gesture and reanimation installation as wanted.
what I have :
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import Gallery from 'react-native-awesome-gallery';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
const ModalInfos = (props) => {
const [showMenu, setShowMenu] = useState(false)
return (
<View style={style.centeredView}>
<View style={style.modalView}>
<Text>{props.infos.name}</Text>
<Text> lots of infos here</Text>
....
....
....
<Text style={{ fontWeight: 'bold' }}> check menu </Text>
<TouchableOpacity
onPress={() => setShowMenu(true)}
>
<MaterialCommunityIcons name="book-open-variant" size={20} color={'#fff'} />
</TouchableOpacity>
</View>
{
showMenu &&
<View style={style.gallery}>
<GestureHandlerRootView style={{ flex: 1 }}>
<Gallery
data={["http://10.0.2.2:8080/images/menu/" + props.infos.barInfos.photomenu1, "http://10.0.2.2:8080/images/menu/" + props.infos.barInfos.photomenu2]}
onIndexChange={(newIndex) => {
console.log(newIndex);
}}
/>
</GestureHandlerRootView>
</View>
}
</View>
)
}
const style = StyleSheet.create({
centeredView: {
flex: 1,
justifyContent: "center",
alignItems: "center",
marginTop: 22,
},
modalView: {
width: '95%',
margin: 20,
backgroundColor: "white",
borderRadius: 20,
padding: 35,
alignItems: "center",
shadowColor: "#000",
shadowOffset: {
width: 0,
height: 2
},
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5
},
gallery: {
flex: 1,
width: "100%",
height: "100%",
position: 'absolute',
zIndex: 10,
backgroundColor: '#202124e6',
}
});
export default ModalInfos;
With or without the GestureHandlerRootViewits the same result, i can see only the first image, and I can't do anything, no swipe, no zoom, not gesture.
I switched to react-native-image-viewing
works more than perfectly

Unable to create curved view in react-native

<View style={{
width: window.width,
height: window.width / 7,
backgroundColor: colors.white}}>
<View style={{
backgroundColor: colors.primary,
borderBottomLeftRadius: 80,
borderBottomRightRadius: 80,
height: window.width / 7,
width: window.width,
flex: 1,
}}>
<View style={{
backgroundColor: '#000',
height: window.width / 7,
width: window.width / 3,
borderRadius: 100,
alignSelf: 'center',
position: 'absolute',
bottom: 0,
overflow: 'hidden',
}}>
</View>
</View>
Check the below solution
import * as React from "react";
import { View, StyleSheet } from "react-native";
export default function Curve() {
return (
<View style={{ margin: 50 }}>
<View style={styles.squreStyle} />
<View style={styles.arcStyle} />
</View>
);
}
const styles = StyleSheet.create({
squreStyle: {
width: "100%",
height: 75,
borderRadius: 12,
backgroundColor: "black",
},
arcStyle: {
width: "20%",
height: 70,
position: "absolute",
bottom: -25,
left: "40%",
borderRadius: 35,
backgroundColor: "black",
transform: [{ scaleX: 5 }, { scaleY: 1 }],
},
});
Sample image of the working code
Edit - Modified according to the requirements of Scroll & Write content inside header.
import * as React from "react";
import { View, StyleSheet, Text, ScrollView } from "react-native";
export default function Curve() {
return (
<ScrollView>
<View style={{marginVertical: 50}}>
<View style={styles.squreStyle}>
<Text style={{ color: "white", textAlign: "center" }}>Sample Header</Text>
</View>
<View style={styles.arcStyle} />
</View>
<View style={{ height: 500, backgroundColor: "green" }} />
<View style={{ height: 500, backgroundColor: "yellow" }} />
</ScrollView>
);
}
const styles = StyleSheet.create({
squreStyle: {
width: "100%",
height: 75,
borderRadius: 12,
backgroundColor: "black",
zIndex: 1,
},
arcStyle: {
width: "20%",
height: 70,
position: "absolute",
bottom: -25,
left: "40%",
borderRadius: 35,
backgroundColor: "black",
transform: [{ scaleX: 5 }, { scaleY: 1 }],
},
});
Hope this helps you. Feel free for doubts.
The thing is react native doesnt let us add border radius to sides unless of same height and width so that it can be a circle. What i did is exactly created a circle and pushed it upwards with top so that it seems like this. You can control the curvature by fixing the height and width and make it dynamic so that in every screen it looks the same.
Please check code below and also the expo snack:
expo-snack
Code:
import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<View style={styles.newD}></View>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
newD:{
height:500,
width:500,
backgroundColor:'red',
marginLeft:-70,
borderRadius:500,
top:-280
},
paragraph: {
margin: 24,
fontSize: 18,
fontWeight: 'bold',
textAlign: 'center',
},
});
Hope it helps. feel free for doubts
You can use react-native-canvas for draw it
import {Dimensions} from 'react-native';
import Canvas from 'react-native-canvas';
const {width} = Dimensions.get('window');
...
drawArc = (canvas) => {
const height = 150;
const ctx = canvas.getContext('2d');
context.moveTo(0,height/2);
context.quadraticCurveTo(width/2, height, width, height/2);
};
...
<Canvas
ref={canvas => drawArc(canvas) />
...
Hope this helps to you.

React Native Button in ScrollView positioning

I have another problem with a button. I have to position it inside a ListView under the last item.
Here are the classes I used:
Notes.js:
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
} from 'react-native';
export default class Note extends Component {
render() {
return (
<View key={this.props.keyval} style={styles.note}>
<Text style={styles.noteText}>{this.props.val.date}</Text>
<Text style={styles.noteText}>{this.props.val.note}</Text>
<TouchableOpacity onPress={this.props.deleteMethod} style={styles.noteDelete}>
<Text style={styles.noteDeleteText}>Del</Text>
</TouchableOpacity>
</View>
);
}
}
const styles = StyleSheet.create({
note: {
position: 'relative',
padding: 20,
paddingRight: 100,
borderBottomWidth:2,
borderBottomColor: '#ededed'
},
noteText: {
paddingLeft: 20,
borderLeftWidth: 10,
borderLeftColor: '#0000FF'
},
noteDelete: {
position: 'absolute',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#2980b9',
padding: 10,
top: 10,
bottom: 10,
right: 10
},
noteDeleteText: {
color: 'white'
}
});
This is the component that I use every time when I want to create a note.
Main.js:
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
TextInput,
ScrollView,
TouchableOpacity,
AsyncStorage,
} from 'react-native';
import Note from './Note';
export default class Main extends Component {
constructor(props){
super(props);
this.state = {
noteArray: [],
noteText: '',
};
this.getSavedNotes(this.state.noteArray);
}
render() {
let notes = this.state.noteArray.map((val, key)=>{
return <Note key={key} keyval={key} val={val}
deleteMethod={()=>this.deleteNote(key)}/>
});
return (
<View style={styles.container}>
<View style={styles.header}>
<Text style={styles.headerText}>- NOTER -</Text>
</View>
<ScrollView style={styles.scrollContainer}>
{notes}
<TouchableOpacity onPress={ this.addNote.bind(this) } style={styles.addButton}>
<Text style={styles.addButtonText}>+</Text>
</TouchableOpacity>
</ScrollView>
<View style={styles.footer}>
<TextInput
style={styles.textInput}
placeholder='Write your note here'
onChangeText={(noteText)=> this.setState({noteText})}
value={this.state.noteText}
placeholderTextColor='white'
underlineColorAndroid='transparent'>
</TextInput>
</View>
</View>
);
}
addNote(){
if(this.state.noteText){
var d = new Date();
this.state.noteArray.push({
'date':d.getFullYear()+
"/"+(d.getMonth()+1) +
"/"+ d.getDate(),
'note': this.state.noteText
});
this.setState({ noteArray: this.state.noteArray });
this.setState({noteText:''});
AsyncStorage.setItem('arr', JSON.stringify(this.state.noteArray));
alert(this.state.noteArray);
}
}
deleteNote(key){
this.state.noteArray.splice(key, 1);
this.setState({noteArray: this.state.noteArray});
}
getSavedNotes = async (noteArray) =>{
try{
let data = await AsyncStorage.getItem('arr');
if(JSON.parse(data))
{
this.state.noteArray = JSON.parse(data);v
}
}catch(error){
alert(error);
}
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
header: {
backgroundColor: '#1A237E',
alignItems: 'center',
justifyContent:'center',
borderBottomWidth: 10,
borderBottomColor: '#ddd'
},
headerText: {
color: 'white',
fontSize: 18,
padding: 26
},
scrollContainer: {
flex: 1,
marginBottom: 100
},
footer: {
position: 'absolute',
bottom: 0,
backgroundColor: '#000000',
left: 0,
right: 70,
zIndex: 10
},
textInput: {
alignSelf: 'stretch',
color: '#fff',
padding: 20,
backgroundColor: '#252525',
borderTopWidth:2,
borderTopColor: '#ededed'
},
addButton: {
position: 'absolute',
zIndex: 11,
right: 0,
bottom: 0,
backgroundColor: '#1A237E',
width: 70,
height: 68,
// borderRadius: 35,
alignItems: 'center',
justifyContent: 'center',
elevation: 8
},
addButtonText: {
color: '#fff',
fontSize: 24
}
});
Here is where I save the notes and display them inside the ListView. After the insertion, the button should appear under the new added note.
Finally the App.js:
import React, { Component } from 'react';
import Main from './app/components/Main.js';
export default class App extends Component {
render() {
return (
<Main/>
);
}
}
Here I just display the Main.js component.
I made it! Here are the changes I made in Main.js file:
<ScrollView style={styles.scrollViewContainer}>
<ScrollView style={styles.scrollContainer}>
{notes}
</ScrollView>
<TouchableOpacity onPress={ this.addNote.bind(this) } style={styles.addButton}>
<Text style={styles.addButtonText}>+</Text>
</TouchableOpacity>
</ScrollView>
And here is the designSheet:
const styles = StyleSheet.create({
container: {
flex: 1,
},
header: {
backgroundColor: '#1A237E',
alignItems: 'center',
justifyContent:'center',
borderBottomWidth: 10,
borderBottomColor: '#ddd',
},
headerText: {
color: 'white',
fontSize: 18,
padding: 26
},
scrollContainer: {
flex: 1,
},
footer: {
position: 'absolute',
bottom: 0,
height: 70,
backgroundColor: '#000000',
left: 0,
right:0,
zIndex: 10,
},
textInput: {
alignSelf: 'stretch',
color: '#fff',
padding: 20,
backgroundColor: '#252525',
borderTopWidth:2,
borderTopColor: '#ededed',
marginRight: 70,
},
addButton: {
position: 'relative',
zIndex: 11,
left: 0,
top: 0,
backgroundColor: '#1A237E',
width: 70,
height: 70,
alignItems: 'center',
justifyContent: 'center',
elevation: 8
},
addButtonText: {
color: '#fff',
fontSize: 60
},
scrollViewContainer: {
flex: 1,
marginBottom: 70,
}
});
I hope this help others aswell

How to center a TextInput when the keyboard opens in React Native

I have a view with 3 textinput and I am trying to center them when the keyboard is opened. I already tried with KeyboardAvoidingView and the result is that all, except the save button disappear. What am I doing wrong?
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
TextInput,
ScrollView,
ListView,
KeyboardAvoidingView,
TouchableOpacity,
AsyncStorage,
} from 'react-native';
import Note from './Note.js';
export default class NoteBody extends Component {
static navigationOptions = {
header: null,
};
constructor(props){
super(props);
this.state = {
noteText: '',
noteTitle: '',
callType: '',
};
}
render() {
return (
<View style={styles.container}>
<View style={styles.header1}>
<Text style={styles.title}>New Note</Text>
</View>
<View style={styles.headerDesign}>
</View>
<View style={styles.header2}>
</View>
<View style= {styles.mainPage}>
<View style={styles.noteBody}>
<TextInput
style = {styles.subject}
placeholder='Raport Number/Note Indentifier'
onChangeText={(noteTitle)=> this.setState({noteTitle})}
value={this.state.noteTitle}
placeholderTextColor='grey'
underlineColorAndroid='transparent'>
</TextInput>
<TextInput
style = {styles.calltype}
multiline = {true}
numberOfLines = {5}
placeholder='Call Type/Other Information'
onChangeText={(callType)=> this.setState({callType})}
value={this.state.callType}
placeholderTextColor='grey'
underlineColorAndroid='transparent'>
</TextInput>
<TextInput
multiline = {true}
numberOfLines = {8}
style={styles.textInput}
placeholder='Notes'
onChangeText={(noteText)=> this.setState({noteText})}
value={this.state.noteText}
placeholderTextColor='grey'
underlineColorAndroid='transparent'>
</TextInput>
</View>
<View style= {styles.footer}>
<TouchableOpacity onPress={ this.addNote.bind(this) } style={styles.addButton}>
<Text style={styles.addButtonText}>SAVE</Text>
</TouchableOpacity>
</View>
</View>
</View>
);
}
addNote(){
const { navigate } = this.props.navigation;
if(this.state.noteText && this.state.noteTitle && this.state.callType){
var d = new Date();
this.props.navigation.state.params.noteArray.push({
'noteName':this.state.noteTitle,
'date':(d.getMonth()+1)+
"/"+d.getDate() +
"/"+ d.getFullYear(),
'callType': this.state.callType,
'note': this.state.noteText
});
this.setState({ noteArray: this.props.navigation.state.params.noteArray });
this.setState({noteText:''});
this.setState({noteTitle:''});
this.setState({callType:''});
AsyncStorage.setItem('arr', JSON.stringify(this.props.navigation.state.params.noteArray));
this.props.navigation.state.params.onNavigateBack();
this.props.navigation.goBack();
}
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
mainPage:{
flex: 2,
alignItems: 'center',
justifyContent:'center',
},
header1:{
backgroundColor: '#000',
alignItems: 'center',
height: 40,
justifyContent: 'center',
},
title:{
color: '#fff',
fontSize: 20,
},
header2:{
marginBottom: 10,
backgroundColor: '#000',
alignItems: 'center',
height: 40,
justifyContent: 'center',
},
headerDesign:{
backgroundColor: '#0000FF',
alignItems: 'center',
height: 20,
justifyContent: 'center',
},
noteBody:{
flex: 2,
position: 'absolute',
top: 0,
bottom: 0,
left: 0,
right: 0,
zIndex: 10,
alignItems: 'center',
marginBottom: 100,
},
textInput: {
alignSelf: 'stretch',
textAlignVertical: 'top',
backgroundColor: '#fff',
color: '#000',
padding: 20,
borderTopWidth:1,
borderTopColor: '#D3D3D3',
borderBottomWidth:1,
borderBottomColor: '#000',
},
addButton: {
position: 'absolute',
zIndex: 11,
bottom: 20,
alignItems: 'center',
justifyContent: 'center',
width: 200,
backgroundColor: '#0000FF',
height: 40,
elevation: 8
},
addButtonText: {
color: '#fff',
fontSize: 20,
},
subject:{
alignSelf: 'stretch',
textAlignVertical: 'top',
backgroundColor: '#fff',
padding: 20,
borderTopWidth:1,
borderTopColor: '#000',
borderBottomWidth:1,
borderBottomColor: '#D3D3D3',
},
calltype:{
alignSelf: 'stretch',
textAlignVertical: 'top',
backgroundColor: '#fff',
padding: 20,
},
footer:{
flex: 3,
alignItems: 'center',
justifyContent:'center',
}
});
Please, copy the code in your text editor and give it a try. Just replace the wrapping view with KeyboardAvoidingView like so: https://facebook.github.io/react-native/docs/keyboardavoidingview.html#keyboardverticaloffset and tell me what else can I do?
You must insert the KeyboardAvoidingView in a ScrollView.
Like so:
<ScrollView>
<KeyboardAvoidingView styles={styles.container} behavior = 'padding' enabled>
</KeyboardAvoidingView>
</ScrollView>

How to create enter passcode authentication in react native?

I am new to React Native development. I want to create an enter passcode authentication page. I have no idea, how to create this page.
Please give me some sample
thankyou in advance.
I want one like this: Passcode authentication
here is my way for passCode:
just use you images and paths according to your project
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
TextInput,
TouchableOpacity,
Image
} from 'react-native';
import H1 from '../../Common/Inheritance/h1';
import { config } from '../../../theme/config';
import { Actions } from 'react-native-router-flux';
class EnterPassCode extends Component {
constructor(props) {
super(props);
this.state = {
passCode: ''
};
this.onBack = this.onBack.bind(this);
}
onBack() {
Actions.EnterTouchId();
}
onChangePassCode() {}
render() {
return (
<View style={styles.pad}>
<TouchableOpacity style={styles.backButton} onPress={this.onBack}>
<Image source={require('../../../assets/img/back_arrow_black.png')} />
</TouchableOpacity>
<View style={styles.title}>
<H1>Create a passcode</H1>
</View>
<View style={styles.codeWrapper}>
<View style={styles.passcodeEnter}>
<TextInput
secureTextEntry={true}
style={styles.textBox}
keyboardType='numeric'
maxLength={4}
autoFocus={true}
onChange={this.onChangePassCode.bind(this)}
onChangeText={passCode => this.setState({ passCode })}
/>
</View>
<View style={styles.circleBlock}>
<View
style={[
styles.circle,
this.state.passCode.length >= 1 && styles.circleFill
]}
></View>
<View
style={[
styles.circle,
this.state.passCode.length >= 2 && styles.circleFill
]}
></View>
<View
style={[
styles.circle,
this.state.passCode.length >= 3 && styles.circleFill
]}
></View>
<View
style={[
styles.circle,
this.state.passCode.length >= 4 && styles.circleFill
]}
></View>
</View>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
pad: {
paddingTop: 75,
margin: 5
},
backButton: {
display: 'flex',
left: 10,
top: 30,
position: 'absolute',
zIndex: 9999,
width: 50,
height: 50,
alignItems: 'center',
justifyContent: 'center'
},
title: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
paddingBottom: 90,
paddingTop: 40
},
codeWrapper: {
position: 'relative'
},
passcodeEnter: {
height: '100%',
opacity: 0,
position: 'absolute',
width: '100%',
zIndex: 9
},
textBox: {
fontSize: 30,
letterSpacing: 15,
textAlign: 'center'
},
circleBlock: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'center'
},
circle: {
borderRadius: 30,
borderWidth: 3,
borderColor: config.primaryColor,
height: 25,
marginLeft: 23,
marginRight: 23,
width: 25
},
circleFill: {
backgroundColor: config.primaryColor,
borderRadius: 30,
borderWidth: 3,
borderColor: config.primaryColor,
height: 25,
marginLeft: 23,
marginRight: 23,
width: 25
}
});
export default EnterPassCode;