Roger Chen
Roger Chen

Reputation: 11

Resolved: Datepicker clicking month error: Attempt to invoke interface method 'int com.facebook.react.bridge.readablearray.size()' on a null object

Everything is ok but when clicking month then got the error: Attempt to invoke interface method 'int com.facebook.react.bridge.readablearray.size()' on a null object reference.

This is the Call page:

import React from 'react';
import { SafeAreaView, View, StatusBar, Alert } from 'react-native';
import {
  Layout,
  Icon, Divider, Text,
  TopNavigation, TopNavigationAction,
  Datepicker } from '@ui-kitten/components';

const MenuIcon = (props) => (
  <Icon {...props} name='menu' style={{width: 36, height: 36, color: 'gray', alignItems: 'center'}}/>
);

export const PatrolScreen = ({ navigation }) => {

  const [date, setDate] = React.useState(new Date());

  const MenuAction = () => (
    <TopNavigationAction icon={MenuIcon} onPress={navigation.toggleDrawer}/>
  );

  return (
    <Layout style={{ flex: 1 }}>
      <StatusBar hidden={false} />
      <TopNavigation title='Patrol' alignment='center' accessoryLeft={MenuAction}/>
      <Divider/>
      <Layout style={{ flex: 1}}>
        <Datepicker
          date={date}
          onSelect={nextDate => setDate(nextDate)}
        />
      </Layout>
    </Layout>
  );
};

The following is my App.js:

import React from 'react';
import * as eva from '@eva-design/eva';
import { ApplicationProvider, IconRegistry } from '@ui-kitten/components';
import { IoniconsPack } from './utils/ion-icons';
import { MaterialCommunityIconsPack } from './utils/materialcommunity-icons';
import { AppNavigator } from './routes/navigation';
import { ThemeContext } from './utils/theme.context';

export default () => {
  const [theme, setTheme] = React.useState('dark');

  const toggleTheme = () => {
    const nextTheme = theme === 'light' ? 'dark' : 'light';
    setTheme(nextTheme);
  };

  return (
    <>
    <IconRegistry icons={[IoniconsPack, MaterialCommunityIconsPack]} />
    <ThemeContext.Provider value={{ theme, toggleTheme }}>
      <ApplicationProvider {...eva} theme={eva[theme]}>
        <AppNavigator />
      </ApplicationProvider>
    </ThemeContext.Provider>
    </>
  );
};

How to resolve this? Thanks.

Upvotes: 1

Views: 185

Answers (1)

Roger Chen
Roger Chen

Reputation: 11

Nothing to do but just updated RN 0.70.3 to 0.70.7 & reinstall @ui-kitten/components and then the bug has gone. It seems the bug fixed by maintainers. Thanks!

Upvotes: 0

Related Questions