我试图获取最新的android源码(5.0,只是为了看看它看起来如何),但是当我尝试从Android SDK下载源时,它给了我一个错误,说没有找到本地 URL.这是日志:
Fetching https://dl-ssl.google.com/android/repository/addons_list-2.xml
Validate XML
Parse XML
Fetched Add-ons List successfully
Fetching URL: https://dl-ssl.google.com/android/repository/repository-10.xml
Validate XML: https://dl-ssl.google.com/android/repository/repository-10.xml
Parse XML: https://dl-ssl.google.com/android/repository/repository-10.xml
Found SDK Platform Android 1.1, API 2, revision 1 (Obsolete)
Found SDK Platform Android 1.5, API 3, revision 4
Found SDK Platform Android 1.6, API 4, revision 3
Found SDK Platform Android 2.0, API 5, revision 1 (Obsolete)
Found SDK Platform Android 2.0.1, API 6, revision 1 (Obsolete)
Found SDK Platform Android 2.1, API 7, revision 3 …
Run Code Online (Sandbox Code Playgroud) 我有一个react-native-paper TextInput,当我导航到屏幕时(使用react-native-navigation),我想自动聚焦它。我尝试过autoFocus={true}
在 TextInput 上进行设置,但没有成功。
在另一次尝试中,我尝试通过监听屏幕上的“焦点”事件来手动聚焦它,但这仅在我第一次打开屏幕时聚焦。有什么办法让它可靠地工作吗?
export default function NewAccountScreen({ navigation }) {
const [name, setName] = useState('');
const textInputRef = createRef();
// This isn't working, neither is autoFocus...
const focusOnInput = () => {
textInputRef.current?.focus();
}
navigation.addListener("focus", focusOnInput);
return (
<View>
<TextInput ref={textInputRef} label="Account name" value={name} onChangeText={setName}/>
</View>
)
}
Run Code Online (Sandbox Code Playgroud) reactjs react-native react-navigation react-hooks react-native-paper