React Native: использование response-native-elements Значок return Не удается найти переменную 'React' - PullRequest
0 голосов
/ 18 октября 2018

Я слежу за кодом, создающим CreateBottomTabNavigation с использованием response-native-элементов для настройки значков.

const AppStack = createBottomTabNavigator(
{ 
    QrCode: { screen: QrCodeScreen },
    Profile: { screen: ProfileScreen }
}, 
{
    navigationOptions: ({navigation}) => ({ 
        tabBarIcon: ({focused, horizontal, tinitColor}) => {
            const { routeName } = navigation.state;
            let iconName;

            if (routeName == 'QrCode') {
                iconName = 'qrcode-scan';
            } else if (routeName == 'Profile') {
                iconName = 'face';
            }

            if (!focused)
                return <Icon type='ionicon' name={iconName} color='#517fa4'/>
            else
                return <Icon type='ionicon' reverse name={iconName} color='#517fa4'/>

            // You can return any component that you like here! We usually use an
            // icon component from react-native-vector-icons

        }
    }),
    tabBarOptions: {
        activeTintColor: 'tomato',
        inactiveBackgroundColor: 'gray'
    }
});

Это дает мне ошибку enter image description here

Что-то не так с пакетом ..

1 Ответ

0 голосов
/ 18 октября 2018

Просто импортируйте React в верхней части вашего файла, как

import React from 'react'; 

Это должно работать.

...