0

Установил react-native-prompt-android и подключил через

npm link react-native-prompt-android

Весь код:

import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View, Button } from 'react-native';
import prompt from 'react-native-prompt-android';

export default function App() {
  const handleButtonPressed = () => prompt(
    'Enter password',
    'Enter your password to claim your $1.5B in lottery winnings',
    [
      { text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel' },
      { text: 'OK', onPress: password => console.log('OK Pressed, password: ' + password) },
    ],
    {
      type: 'secure-text',
      cancelable: false,
      defaultValue: 'test',
      placeholder: 'placeholder'
    }
  );
  return (
    <View style={styles.container}>
      <Text>Open up App.js to start working on your app!</Text>
      <Button title='Click me!' onPress={handleButtonPressed} />
      <StatusBar style="auto" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Вот ошибка:

Android Bundling failed 84ms
Unable to resolve "react-native-prompt-android" from "App.js"

1 ответ 1

0

Он не видит ваш пакет. Рекомендую проверить, есть ли линковка в вашем проекте android-> settings.gradle. Можно выполнить:

react-native link react-native-prompt-android

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.