dohooo / react-native-table-component

🌱Build table for react native
MIT License
730 stars 188 forks source link

borderStyle - expected NSNumber or NSString (iOS) #112

Open MOwais opened 4 years ago

MOwais commented 4 years ago

Getting this error in iOS.

Error:

Expected NSNumber or NSString for RCTBorderStyle, received NSMutableDictionary: {
    borderColor = "#939696";
    borderWidth = 2;
}

RCTConvertEnumValue
    RCTConvert.m:265
+[RCTConvert RCTBorderStyle:]
-[RCTViewManager set_borderStyle:forView:withDefaultView:]
-[RCTComponentData callCustomSetter:onView:withProp:isShadowView:]
__49-[RCTComponentData createPropBlock:isShadowView:]_block_invoke_2
__49-[RCTComponentData propBlockForKey:isShadowView:]_block_invoke_2
RCTPerformBlockWithLogFunction
RCTPerformBlockWithLogPrefix
__49-[RCTComponentData propBlockForKey:isShadowView:]_block_invoke
__37-[RCTComponentData setProps:forView:]_block_invoke
__NSDICTIONARY_IS_CALLING_OUT_TO_A_BLOCK__
-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]
-[RCTComponentData setProps:forView:]
__50-[RCTUIManager createView:viewName:rootTag:props:]_block_invoke.415
__44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke
__44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke.485
__RCTExecuteOnMainQueue_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
UIApplicationMain
main
start

Usage:

     ...
        <Table borderStyle={{borderWidth: 2, borderColor: "#939696"}}>
        ...

env:

 react: 16.9.0 => 16.9.0 
 react-native: ^0.61.5 => 0.61.5
peacefixation commented 4 years ago

I have the same issue. I define a simple

<Table borderStyle={{borderWidth: 1, borderColor: 'white'}}>

and generate this error:

ExceptionsManager.js:126 Expected NSNumber or NSString for RCTBorderStyle, received NSMutableDictionary: { borderColor = white; borderWidth = 1; }

I see another warning message that says:

Warning failed prop type: Invalid prop borderWidth of type 'string' supplied to 'Cell', expected 'number'. Bad object: {"borderWidth": "solid"}

This object is generated by the table internally, I don't define it.

MOwais commented 4 years ago

I have the same issue. I define a simple

<Table borderStyle={{borderWidth: 1, borderColor: 'white'}}>

and generate this error:

ExceptionsManager.js:126 Expected NSNumber or NSString for RCTBorderStyle, received NSMutableDictionary: { borderColor = white; borderWidth = 1; }

I see another warning message that says:

Warning failed prop type: Invalid prop borderWidth of type 'string' supplied to 'Cell', expected 'number'. Bad object: {"borderWidth": "solid"}

This object is generated by the table internally, I don't define it.

You need to add borderStyle to the TableWrapper component instead"

<TableWrapper borderStyle={{borderWidth: 1, borderColor: '#fff'}}>
    <Table>
           {
              ...
           }
   </Table>
</TableWrapper>