'use strict';
import React from 'react';
import {
View,
StyleSheet,
Text,
Image,
TextInput,
} from 'react-native';
var Login = React.createClass({
render: function () {
return (
<View style={styles.container}>
<Text style={styles.heading}>My First App</Text>
<TextInput
style={styles.input}
placeholder='User name'>
</TextInput>
<TextInput
style={styles.input}
placeholder='Password'
secureTextEntry='true'>
</TextInput>
</View>
);
}
});
var styles = StyleSheet.create({
container: {
backgroundColor: '#FFFFFF',
padding: 16,
},
heading: {
fontSize: 30,
marginTop: 10,
textAlign: 'center',
},
input: {
height: 50,
marginTop: 10,
padding: 4,
fontSize: 18,
borderWidth: 1,
borderColor: '#112233'
}
});
export default Login;
更新属性&#39; secureTextEntry&#39;时出错管理的视图:AndroidTextInput TypeError:预期的动态类型
boolean', but had type
字符串&#39; updateViewProp ViewManagersPropertyCache.java:95 的setProperty ViewManagerPropertyUpdater.java:129 updateProps ViewManagerPropertyUpdater.java:48 updateProperties ViewManager.java:36 CreateView的 NativeViewHierarchyManager.java:227 执行 UIViewOperationQueue.java:150 dispatchPendingNonBatchedOperations UIViewOperationQueue.java:923 doFrameGuarded UIViewOperationQueue.java:895 doFrame GuardedFrameCallback.java:31 doFrame ReactChoreographer.java:136 doFrame ChoreographerCompat.java:107 跑 Choreographer.java:869 doCallbacks Choreographer.java:683 doFrame Choreographer.java:616 跑 Choreographer.java:857 handleCallback Handler.java:751 在DispatchMessage Handler.java:95 环 Looper.java:154 主要 ActivityThread.java:6123 调用 Method.java 跑 ZygoteInit.java:867 主要 ZygoteInit.java:757
请帮我解决此错误
答案 0 :(得分:0)
secureTextEntry = {true}而不是字符串,在花括号中声明了布尔类型
<TextInput
style={styles.input}
placeholder='Password'
secureTextEntry={true}>
</TextInput>