2016-06-14 79 views
0

我正在使用react-native-search-bar進行搜索。我們可以更改搜索欄的樣式,而不是在iOS中使用默認的樣式嗎?如果有可能,那麼如何改變它? 我想在節點模塊中找到,但沒有得到有用的東西,我可以改變風格,如果有人能幫助我。反應本機中的自定義樣式搜索欄

感謝

回答

1

找到提供給您的屬性最好的地方,是檢討propTypes這裏定義:

https://github.com/umhan35/react-native-search-bar/blob/master/SearchBar.js#L13

下面是一個代碼示例,你可以玩考出風格這個組件的相關屬性:

import React from 'react'; 
import { 
    AppRegistry, 
    View 
} from 'react-native'; 

import SearchBar from 'react-native-search-bar'; 

class MyApp extends React.Component { 
    render() { 
    return(
     <View> 
     <SearchBar 
      barTintColor="red" 
      tintColor="green" 
      textColor="blue" 
      textFieldBackgroundColor="pink" 
      hideBackground={false} 
      barStyle="default" 
      searchBarStyle="default" 
     /> 
     </View> 
    ); 
    } 
} 

AppRegistry.registerComponent('MyApp',() => MyApp); 
+0

但是,如果我想使用總的不同的搜索欄,如圓角和沒有像這樣的邊界,是否有可能在iOS? – Mack