Skip to content

The readme example throws "data is not defined" #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Torniojaws opened this issue Oct 5, 2022 · 0 comments
Open

The readme example throws "data is not defined" #12

Torniojaws opened this issue Oct 5, 2022 · 0 comments

Comments

@Torniojaws
Copy link

React Native v0.64.3 on Expo using this code:

import { Modal, StyleSheet, Text, View } from 'react-native';
import { CustomButton } from 'src/components/Buttons/CustomButton';
import InfiniteScroll from 'react-native-infinite-looping-scroll';

interface Params {
  visible: boolean;
  setTimePickerVisible: any;
}

export const TimePicker = ({ visible, setTimePickerVisible }: Params) => {
  return (
    <Modal
      animationType="slide"
      transparent={true}
      visible={visible}
      onRequestClose={() => setTimePickerVisible(!visible)}
    >
      <View>
        <Text>Select time</Text>
        <View>
          <InfiniteScroll
            data={[{ key: '1' }, { key: '2' }, { key: '3' }, { key: '4' }, { key: '5' }, { key: '6' }, { key: '7' }]}
            renderItem={({ item }: any) => (
              <View>
                <Text>{item.key}</Text>
              </View>
            )}
          />
        </View>
        <CustomButton title={'Set time'} onPressFunction={() => setTimePickerVisible(!visible)} />
      </View>
    </Modal>
  );
};

Throws

Uncaught ReferenceError: data is not defined
at new InfiniteScroll (index.js:13)
at constructClassInstance (react-dom.development.js:12716)
at updateClassComponent (react-dom.development.js:17425)
at beginWork (react-dom.development.js:19073)
at HTMLUnknownElement.callCallback (react-dom.development.js:3945)
at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
at invokeGuardedCallback (react-dom.development.js:4056)
at beginWork$1 (react-dom.development.js:23964)
at performUnitOfWork (react-dom.development.js:22779)
at workLoopSync (react-dom.development.js:22707)
at renderRootSync (react-dom.development.js:22670)
at performSyncWorkOnRoot (react-dom.development.js:22293)
at react-dom.development.js:11327
at unstable_runWithPriority (scheduler.development.js:468)
at runWithPriority$1 (react-dom.development.js:11276)
at flushSyncCallbackQueueImpl (react-dom.development.js:11322)
at flushSyncCallbackQueue (react-dom.development.js:11309)
at discreteUpdates$1 (react-dom.development.js:22420)
at discreteUpdates (react-dom.development.js:3756)
at dispatchDiscreteEvent (react-dom.development.js:5889)

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant