npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rn-inputaccessoryview

v1.0.7

Published

Helpers to make InputAccessoryView more useful

Downloads

9

Readme

rn-inputaccessoryview-helper

Helper context/provider to make InputAccessoryView more useful. Requires 0.56+ (Expo 29+)

Install

npm i rn-inputaccessoryview-helper

Useage

Wrap your app in the provider

// App.js
import {InputAccessoryProvider} from 'rn-inputaccessoryview-helper';
import FormAccessory from './FormAccessory';

export default class App {
  render(){
    return (
      <InputAccessoryProvider>
        {// rest of app goes here}
        <FormAccessory />
      </InputAccessoryProvider>
    )
  }
}

Use withInputAccessory to set up and use function

withInputAccessory allows you to define functions in a component, and fire them from the InputAccessoryView. Below is a simple example (that doesn't make a lot of sense). See this snack for a better example of how this can be super handy: https://snack.expo.io/@buishi/inputaccessory-demo

// SomeForm.js
import {Keyboard, View, TextInput} from 'react-native';
import {withInputAccessory} from 'rn-inputaccessoryview-helper';

@withInputAccessory
export default class SomeForm {
  constructor(props) {
    super(props)
  }

  componentWillMount() {
    // pass function name and function reference
    this.props.setAccessoryFunction('done', this.done);
  }

  done() {
    Keyboard.dismiss()
  }

  render() {
    const {setAccessoryFunction} = this.props;
    return (
      <View>
        <TextInput
          style={styles.input}
          inputAccessoryViewID="form"
        />
        <TextInput
          style={styles.input}
          inputAccessoryViewID="form"
        />
        <TextInput
          style={styles.input}
          inputAccessoryViewID="form"
        />
      </View>
    )
  }
}

Note: deviceID has to match inputAccessoryViewID if you want it to open when you focus a textinput. deviceID can't be dynamic.

// FormAccessory
import {InputAccessoryView, StyleSheet} from 'react-native';
import {withInputAccessory} from 'rn-inputaccessoryview-helper';

export default class FormAccessory {
  constructor(props) {
    super(props);
  
  }
  
  render() {
    return (
      <InputAccessoryView style={styles.inputAccessory} deviceID="form">      
        <View style={styles.wrapper}>
           <View style={{ flex: 1 }} />
            <TouchableOpacity onPress={() => this.props.done()}>
              <Text>Done</Text>
            </TouchableOpacity>
          </View>
        </View>
      </InputAccessoryView>
    )
  }
}

const styles = StyleSheet.create({
  inputAccessory: {
    width: Dimensions.get('window').width,
    borderColor: 'blue',
    borderWidth: 1,
    padding: 10,
    paddingLeft: 5,
    height: 40,
  },
  wrapper: { 
    flexDirection: 'row', 
    width: '100%',
  }
})

TODO:

  • [ ] Fix refs with React.forwardRef (this issue: https://github.com/gaearon/react-proxy/issues/82)