react-native-easy-toast icon indicating copy to clipboard operation
react-native-easy-toast copied to clipboard

Toast Message off screen in long lists

Open RajivPilgaonkar opened this issue 6 years ago • 4 comments

Hi, I'm trying to use easy-toast and it works very well. But there is one instance I have of a long flatlist. If the list is rather long, I realized that the toast message appears but it is off the screen and you have to scroll in order to see it. Not sure if I am doing something wrong. Here is the code. I have used this on an Android device.

renderHeaderList() { return (

  <View style={{ flex: 1 }}>

    <ScrollView
      ref={(c) => { this.scroll = c; }}
    >

      <FlatList
        ref={(ref) => { this.flatListRef = ref; }}
        data={{ g_data }}
        renderItem={this.renderItem}
        keyExtractor={(item) => item.srNo}
      />

  </ScrollView>

  <Toast
    ref="toast"
    position={'top'}
    style={{ backgroundColor: 'red' }}
  />

  </View>
);

}

RajivPilgaonkar avatar Apr 08 '19 05:04 RajivPilgaonkar

Getting the same issue. Any updates here ? @RajivPilgaonkar were you able to overcome this anyway ?

anujraghuvanshi avatar Jan 19 '23 18:01 anujraghuvanshi

We moved away from toasts so I did not follow up.

On Thu, Jan 19, 2023, at 11:43 PM, Anuj Raghuvanshi wrote:

Getting the same issue. Any updates here ? @RajivPilgaonkar https://github.com/RajivPilgaonkar were you able to overcome this anyway ?

— Reply to this email directly, view it on GitHub https://github.com/crazycodeboy/react-native-easy-toast/issues/72#issuecomment-1397408556, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOQKCZTJGZFB2YJHYFZQJLWTF73BANCNFSM4HEFIC7A. You are receiving this because you were mentioned.Message ID: @.***>

RajivPilgaonkar avatar Jan 20 '23 01:01 RajivPilgaonkar

i got same issue in long list

what can i do ?

Tchaikovsky1114 avatar Jan 27 '23 01:01 Tchaikovsky1114

I have a solution (it's 2023, so 4 years later 😂 )

  • Try position : fixed; like this
<Toast
    ref="toast"
    position={'top'}
    style={{ backgroundColor: 'red', position: fixed }}
  />
  • If didnt worked, try writing it in another View component and give position fixed to it
<View style={{position: fixed}}>
  <Toast
    ref="toast"
    position={'top'}
    style={{ backgroundColor: 'red' }}
  />
</View>
  • Still not working, then try calculating scroll position using JS, and give offset that value I dont have a code snippet for that as i dont know how to calculate scroll position 😅

shayan1234554321 avatar Mar 26 '23 14:03 shayan1234554321