birdwingo / react-native-instagram-stories

🚀 Instagram stories is a versatile React Native component designed to display a horizontal scrollable list of user stories, similar to the stories feature found in the Instagram app.
https://birdwingo.com
MIT License
120 stars 34 forks source link

renderFooter is not working. #55

Closed Ahsanali012 closed 4 months ago

Ahsanali012 commented 6 months ago

renderFooter is not working, As i want to show custom buttons , Can you provide me the example how can i work to show buttons?

const stories = [
    {
      id: 'user1',
      name: 'User 1',
      imgUrl: 'imageUrl.png',
      stories: [
        {
          id: 'story1',
          sourceUrl: 'imageUrl.png',
          renderContent: () => (
            <View style={tw`mt-[15%] p-3`}>
              <Text style={tw`font-bold text-white`}>This is custom content for User 1's first story</Text>
            </View>
          ),
          renderFooter: () => (
            <View style={{ backgroundColor: 'red', padding: 10, alignSelf: 'center' }}>
              <Button title="Like" onPress={handleLikePress} />
              <Button title="Share" onPress={handleSharePress} />
            </View>
          ),
        }

      ],
    }
  ];
LukasFridmansky commented 6 months ago

Hi, I checked both android and ios and both worked as expected. I used this function: () => <View style={{ backgroundColor: 'red', width: '100%', height: 100 }} />. Are you sure your Button component renders correctly? I don't see any issue in your code.

Ahsanali012 commented 6 months ago

Hi, I checked both android and ios and both worked as expected. I used this function: () => <View style={{ backgroundColor: 'red', width: '100%', height: 100 }} />. Are you sure your Button component renders correctly? I don't see any issue in your code.

I'll try again and let you know

visace commented 6 months ago

@Ahsanali012 You are missing the return ..

renderFooter: () => return ( <View style={{ backgroundColor: 'red', padding: 10, alignSelf: 'center' }}>

Ahsanali012 commented 6 months ago

I cant show footer and also i need to show delete button so i can trigger delete for each story how can i do that ?

`  const InstaStories = AllStoriesPosts?.map((story) => ({
    id: story.id,
    name: story.name,
    imgUrl: story.imgUrl,
    stories: story.stories.map((item) => ({
      id: item.id,
      mediaType: item.mediaType,
      sourceUrl: item.sourceUrl,
      renderContent: () => (
        <View style={tw`mt-[15%] flex-row justify-between  w-full p-3`}>
          <Text style={tw`font-bold mx-2 text-base text-white`}>
            {item?.description}
          </Text>
          {auth.isauth && (
            <View style={tw``}>
              {/* <Button title="Delete" onPress={() => deleteStory(item?.id)} /> */}
              <Text style={tw`font-bold mx-2 text-base text-white`}>
                delete
              </Text>
            </View>
          )}
        </View>
      ),
      renderFooter: () => (
        <View
          style={{
            backgroundColor: "red",
            height: 50,
            width: "100%",
            padding: 10,
            alignSelf: "center",
          }}
        >
          <Text style={tw`font-bold mx-2 text-base text-white`}>Footer</Text>
        </View>
      ),
    })),
  }));`