Skip to content
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

Cannot be multiplied #10

Closed
dellwatson opened this issue May 22, 2019 · 4 comments
Closed

Cannot be multiplied #10

dellwatson opened this issue May 22, 2019 · 4 comments

Comments

@dellwatson
Copy link

Let's say it's instagram images, and I want each image carries a single bottom-sheet for image-optional...

i ve tried with action-sheet for iOS device, and now im looking for Android-native-feeling but this module isnt working for duplicating.

@nysamnang
Copy link
Owner

nysamnang commented May 23, 2019

@dellwatson It's quite simple just by changing the ref name.

Example:

  <View>
        <Button
          title="OPEN BOTTOM SHEET"
          onPress={() => {
            this.RBSheet.open();
          }}
        />

        <Button
          title="OPEN BOTTOM SHEET 2"
          onPress={() => {
            this.RBSheet2.open();
          }}
        />

        <RBSheet
          ref={ref => {
            this.RBSheet = ref;
          }}>
          <YourOwnComponent />
        </RBSheet>

        <RBSheet
          ref={ref => {
            this.RBSheet2 = ref;
          }}>
          <YourOwnComponent />
        </RBSheet>
  </View>

@dellwatson
Copy link
Author

dellwatson commented May 23, 2019

@nysamnang
thanks but this is static, i want to make it more dynamic.
let's say i have random amount of images, and each of them require this bottom sheet,
so I mnot sure how to call all of them

first I iterate the images,

//main_render
<View>
    images.map(item => this._renderItem(item, index))
<View>

//render_item
_renderItem= (item, index)=> {
...,
<Button title=`OPEN BOTTOM SHEET-${index}`  //renaming the title 
          onPress={() => {   this.RBSheet.open()  }}  />   **//cant rename the func here**

        <RBSheet
          ref={ref => {
            this.RBSheet = ref;
          }}>
          <YourOwnComponent />
        </RBSheet>
}

I thought it would work, without renaming them, but turns out it doesnt, because well the ref is still the same and imnot sure how to make it more dynamic.
the actionSheetIOS is pretty easy to use and dynamic without naming them all. but I want this bottomSheet for android feeling

@nysamnang
Copy link
Owner

@dellwatson

  _renderItem = (item, index) => (
      <View>
        <Button title=`OPEN BOTTOM SHEET-${index}` onPress={() => this[RBSheet + index].open()} />
        <RBSheet
          ref={ref => {
            this[RBSheet + index] = ref;
          }}>
          <YourOwnComponent />
        </RBSheet>
      </View>
    );

Happy coding !

@brixbimboavengoza
Copy link

@dellwatson

  _renderItem = (item, index) => (
      <View>
        <Button title=`OPEN BOTTOM SHEET-${index}` onPress={() => this[RBSheet + index].open()} />
        <RBSheet
          ref={ref => {
            this[RBSheet + index] = ref;
          }}>
          <YourOwnComponent />
        </RBSheet>
      </View>
    );

Happy coding !

Hi, do you have this example in functional? ty!

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

3 participants