Git Product home page Git Product logo

react-native-search-box's Introduction

Blog

We write all blog, events etc...

react-native-search-box's People

Contributors

aknad avatar akread avatar alnorris avatar amin3mej avatar anhtuank7c avatar arcaderenegade avatar bathlamos avatar dkphung avatar gunn avatar jacobbodkin avatar jaxgit avatar mlapeter avatar moughxyz avatar qingqingliu avatar rsml avatar se1exin avatar timofei7 avatar yjb94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-search-box's Issues

onSearch not firing

Here's my code:
`import Search from "react-native-search-box";

export default class App extends Component {
onSearch = () => {
alert("!");
}

onCancel = () => {
    alert("????");
}

render() {
    return (
        <View style={styles.container}>
            {/* Hide status bar */}
            <StatusBar hidden={true} />

            {/* Header */}
            <View style={styles.headerContainer}>
                <Text style={styles.text}>
                    NeuralNews
                </Text>
            </View>

            {/* Search field */}
            <View style={styles.searchBar}>
                <Search
                    ref={"search_box"}
                    onSearch={this.onSearch}
                    onCancel={this.onCancel}
                 />
            </View>
        </View>
    );
}

}`

For some reason, the onSearch method isn't firing even though the onCancel one is. What exactly causes the onSearch to fire? I am testing on a simulator, and pressing the 'Search' button on the iPhone keyboard isn't seeming to work.

Ability to remove cancel button?

I'd like to remove the cancel button completely and just have the animation of search moving from middle to left. Without a cancel button or animation. Is this potentially possible in the near future?

react-native trigger enter key press in afterSearch when the user stops typing

I am using this search box to load the contacts list page but there are a few nested API calls retrieving data based on what the user has typed.

In my experience the results being loaded onChangeText as opposed to them being loaded on onAfterSearch and pressing the enter key is more seamless and smooth

How can I trigger the click event on the enter key manually from the code to load the view?

Adding Search Box in Navigation bar

I'm using react-navigation.
I want to add search bar on stack navigator.
but I'm not able to change left margin and width of search bar.
I want it after profile page.
how can I do it ?

navigationOptions: {
      headerTitleStyle: { color: '#fff' },
      header: props => <ImageHeader {...props} />,
      headerTitle: <Search backgroundColor='transparent' left='40'/>,
      headerLeft: <ProfilePicture />,
    },

screen shot 2017-08-18 at 1 01 39 pm

Invalid NSTextAlignment 'text'

The latest RTL feature introduced a bug when using the component on iOS without isRtl.

on line 412: textAlign: isRtl ? 'right' : 'text', should be textAlign: isRtl ? 'right' : 'left', ?

Right now it breaks with Invalid NSTextAlignment 'text' error

Why populate searchbox value only the first time then it become empty

You should keep the value of input search box populated and so the delete icon should still appears.
For example:
onSearch function I called setState with searchText,
after delete the search, then type again, the searchBox didn't display the searchText inside.

Please fix it.

Search box keeps shifting infinity to right when inside a view with the following styles

This is my view:

  <View style={styles.containerStyle}>
      <Text> Hello </Text>
      <Search
        placeholder={placeholder}
        backgroundColor="#f8fdff"
        borderColor="#ffffff"
      />
    </View>

with the following styles:

const styles = {
  containerStyle: {
    height: 40,
    flex: 1,
    flexDirection: 'row',
    alignItems: 'center'
  }
};

What I want is for a text label to be next to the search box. However, the search box keeps shifting infinity to the right of the screen (at one point the place holder also disappears to the right). I am thinking it has something to do with flexDirection: row . However I do not understand this behavior. What is going wrong?

Also, how to I alight the placeholder (by default its aligning to the right for me?)

Thank you

autoCapitalize=none

How can autoCapitalize=none be set? This is especially important for keyboardType="url".

Centering the placeholder

So I've been playing with this library and so far is been great, the one problem that I have is that the SearchBar won't have the placeholder centered if my placeholder is something like Jump to a conversation and the thing is that setting the Collapse and Expand margins isn't the best way to go.

any pointers on how to resolve it?

The input sometimes gets centralized in the text box.

If you click on the text box of the search field and quickly begin typing text, it might get centralized in the text box (at least for some time). If the bug does not get reproduced try clicking "cancel" button and typing again and again, this behavior should cause the bug sooner or later.

Integration with UI Automated Testing

Unfortunately, SearchBox currently doesn't support any TestIDs properties, which makes it extremely rigid to UI testing.

Would be great to have optional testIDs to SearchBox props for both Input and Cancel button so it could be visible in view hierarchy and accessible for UI testing frameworks (eg Detox).

Thanks in advance :)

Change Input Text

Hi, is there any way to change the current input text of the search programatically?

Animation cannot be disabled.

I don't need the animation in my application. But how can I disable the animation and keep my search icon and placeholder left aligned?

render a view afterDelete

I am trying to re-render a view in the onDelete method, but for some reason it wont render a view.

afterDelete() { return new Promise((resolve, reject) => { alert('deleting') this.renderView(); resolve(); }); }

The alert works fine, but the view does not re-render.
any ideas?

Example?

Documentation doesn't make sense really, it doesn't even have a complete example

Keyboard appearance

Hi.
I'd like suggest you add property 'keyboardAppearance' to inner AnimatedTextInput. In some cases UI design does not have standard appearance.
II believe it might be helpful for someone.

Thank you in advance.

Remove "Cancel Button"

Hi, i'm using your search-box.
Can i remove the cancel button?
If so, how can i remove it?

Auto focus

Hi, is there a way to auto focus the search input on render?

Error with 'textAlign' in shadow node of type: AndroidTextInput

When I installed the package and started using the code in my project. It shows an error--->
"Error while updating property 'textAlgin' in a shadow node of type: AndroidTextInput"
Invalid textAlign: text

=> When I checked through the file - index.js. I can see in the line #406 - textAlign: isRtl ? 'right' : 'text', Once I replace the text with other style element it works fine.

Could you please check and confirm.. wheater it is an issue to be fixed or it an user end issue.?

Possibility to only target the cancelButton's onPress

I was wondering if it was possible to only target the cancelButton's onPress handling.

Right now, I use the searchbox as header that triggers a redirect to another set of screens with the results. onCancel the user gets redirected to the previous screen. However, onCancel feels almost the same as I would be using onBlur. I was hoping onCancel was only the handling of the cancel button, but I was wrong.

Is there a way to target only the cancel Button to attach an action to?

Kind regards!

Adding an onBlur property

This is a great component and works really well for something so new.

Is there any chance that we can get an onBlur property added.

I'm happy to add it and provide you with a pull request if that helps?

Element ref was specified as a string (search_box) but no owner was set.

Hi,

I suddenly started getting this error after a reinstall of my node_modules, no update or anything. Does anyone know how to solve this?

Thank you!

Invariant Violation: Element ref was specified as a string (search_box) but no owner was set. This could happen for one of the following reasons:
1. You may be adding a ref to a functional component
2. You may be adding a ref to a component that was not created inside a component's render method
3. You have multiple copies of React loaded
See https://fb.me/react-refs-must-have-owner for more information.

Edit:
This issue seems to be due to problems when installing packages. Reinstalling should fix.

cancelButtonStyle used both in <Animated.View> an <Text> causes warnings for some style properties

Hello,

It seems like the cancelButtonStyle prop is passed in two components:

This causes warnings when we uses style properties that are not compatible with bot <Animated.View /> and `.

Example:

<SearchBar
  cancelButtonStyle={{ fontSize: 20 }}
/>

Will show a warning:

Warning: Failed prop type: Invalid props.style key fontSize supplied to RCTView.

My suggestion would be to make two new props (cancelButtonViewStyle and cancelTextButtonStyle) to customize <Animated.View /> and <Text>. The cancelButtonStyle should throw a deprecation warning. This would be backward compatible.

I'd be happy to make a PR if this makes sense

It seems like yarn is caching packages by version number, and the last change made [here](https://github.com/agiletechvn/react-native-search-box/commit/2801cdd11b516cbbb48f137a70d051ad959d677b) to fix PropTypes was not cached due to lack of version bumping.

It seems like yarn is caching packages by version number, and the last change made here to fix PropTypes was not cached due to lack of version bumping.

Quickfix:
"react-native-search-box": "https://github.com/agiletechvn/react-native-search-box" in package.json

More proper way:
@anhtuank7c Bump version number to 0.0.14

Originally posted by @kacgrzes in #46 (comment)

there is no 0.0.14 version available

Keyboard Launch Loop

I'm trying to integrate the search element into the Android version of my React Native app, but when the view containing the search element is loaded, no matter where I navigate in the app when the keyboard attempts to launch, it immediately closes back. In regular text inputs, this is where the action ends, but in the search element, it creates an infinite loop where the beforeFocus, onFocus, and afterFocus events all fire one after the other in a never ending cycle. The app becomes unresponsive to touch, and the "Cancel" button can't be operated.

Does anyone know what might be causing this? Initially, I thought it might be that the search bar was inside a ListView, but the same behavior happened when it was placed outside of it. I've tried debugging it for the past couple hours, but can't seem to find the source of the issue.

Thanks in advance!

React.createElement: type is invalid

I encountered this error while using :

W/ReactNativeJS( 7420): Warning: React.createElement: type is invalid -- expecte d a string (for built-in components) or a class/function (for composite componen ts) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of StaticRenderer.

placeholder text to the left

Hi there,

I am trying to place the placeholder text to the extreme left instead of having it center aligned. I tried playing around with some of the props but unfortunately none of them worked.

Any idea on how we can do this?

How to do a request in onChangeText function?

Why should I must return a Promise type in onChangeText function? so how to do a requst in this function?

return new Promise((resolve, reject) => { CRMManager.getSearchResult(this.page, 10, keyword).then((results) => { alert(1) this.setState({ dataSource: this.state.dataSource.cloneWithRows(results), }) resolve(); }). catch(() => { alert(2) }); });

they will alert both 1 & 2.

Make cancel text optional

This is a really cool component - is there a way to disable the cancel text and it's associated functionality so that the search box just has the search icon and the clear icon?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.