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

react-native-sk-keyboard-responder

v1.0.2

Published

Component which wrap a View, and respond to keyboard show up: 1 move up 2 reduce height

Downloads

7

Readme

react-native-sk-keyboard-responder

##What is it

react-native-sk-keyboard-responder is a component which wrap a View, and respond to keyboard show up, only for ios.

There are two way to respond

1 move up

Move view up, and clear a space for keyboard

It changes view’s position(‘bottom’ property), does not change view’s size

2 reduce height

Reduce view’s height, and clear a space for keyboard

It changes view’s size(‘height’ property), does not change view’s position

So I come up with 2 component, one component one responding way

1 KeyBoardMoveView

respond to moving view up

2 KeyBoardResizeView

respond to reducing view's height

##How to use it

  1. npm install react-native-sk-keyboard-responder@latest --save

  2. use KeyBoardMoveView

Move view up when keyboard show, move view down when keyboard hide

Change view's position, not change any view's size


 'use strict';
 import React, {
   AppRegistry,
   StyleSheet,
   Text,
   TextInput,
   View
 } from 'react-native';

 var {KeyBoardMoveView} = require('react-native-sk-keyboard-responder');

 var test = React.createClass({
   getList: function(){
     var list = [];
     for (var i = 0; i < 10; i++) {
       list.push(<Text key={i} style={styles.item}>{'项目 ' + i}</Text>)
     }
     return list;
   },
   render: function(){
     return (
       <View style={styles.container}>
        <View style={styles.listBox}>
          {this.getList()}
        </View>
        <KeyBoardMoveView style={styles.inputBox}>
          <TextInput
            style={styles.input}
            placeholderTextColor='#AFAFAF'
            placeholder=' 期待您的评论, 让这个世界更美好'
            />
        </KeyBoardMoveView>
       </View>
     )
   },
 });


 const styles = StyleSheet.create({
   container: {
     flex: 1,
     backgroundColor: 'grey',
   },
   listBox: {
     flex: 1,
     justifyContent: 'space-around',
   },
   item: {
     fontSize: 17,
   },
   inputBox: {
     height: 50,
     margin: 5,
     borderWidth:1,
     borderColor:'#E1E1E1',
     borderRadius: 5,
     backgroundColor:'#FFF',
   },
   input: {
    flex: 1,
    fontSize:14,
   }
 });

 AppRegistry.registerComponent('test', () => test);


  1. use KeyBoardResizeView

Reduce view's height when keyboard show, expand view's height when keyboard hide

Change view's size, not change view's position

 'use strict';
 import React, {
   AppRegistry,
   StyleSheet,
   Text,
   TextInput,
   View
 } from 'react-native';

 var {KeyBoardResizeView} = require('react-native-sk-keyboard-responder');

 var test = React.createClass({
   getList: function(){
     var list = [];
     for (var i = 0; i < 10; i++) {
       list.push(<Text key={i} style={styles.item}>{'项目 ' + i}</Text>)
     }
     return list;
   },
   render: function(){
     return (
      <KeyBoardResizeView style={styles.container}>
        <View style={styles.listBox}>
          {this.getList()}
        </View>
        <View style={styles.inputBox}>
          <TextInput
            style={styles.input}
            placeholderTextColor='#AFAFAF'
            placeholder=' 期待您的评论, 让这个世界更美好'
            />
        </View>
      </KeyBoardResizeView>
     )
   },
 });


 const styles = StyleSheet.create({
   container: {
    //  flex: 1,
     backgroundColor: 'grey',
   },
   listBox: {
     flex: 1,
     justifyContent: 'space-around',
   },
   item: {
     fontSize: 17,
   },
   inputBox: {
     height: 50,
     margin: 5,
     borderWidth:1,
     borderColor:'#E1E1E1',
     borderRadius: 5,
     backgroundColor:'#FFF',
   },
   input: {
    flex: 1,
    fontSize:14,
   }
 });

AppRegistry.registerComponent('test', () => test);

##Properties

Any View property and the following:

| Prop | Description | Default | |---|---|---| |initHeight|Set view's height before keyboard show up, only for KeyBoardResizeView. For example, when you render the view under NavigatorBar, you maybe want less height |None|