Skip to content

Conversation

@HomeroRR
Copy link
Collaborator

No description provided.

@msftclas
Copy link

msftclas commented Mar 10, 2020

CLA assistant check
All CLA requirements met.

@thewulf7
Copy link
Contributor

@HomeroRR can you pls remove (or move to examples folder) example of Android and iOS from root folder of TwoPaneView - package that will be downloaded should only contain code that we be used without any examples :)

@thewulf7
Copy link
Contributor

@HomeroRR thanks, can you also convert your JS code to TS ?:)

Copy link
Contributor

@thewulf7 thewulf7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls have a look on the comments

const children = React.Children.toArray(this.props.children);
if (children.length > 0) {
return (
<View key="pane1" style={{width:size.width, height:size.height}}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would you use width and height and Dimensions in General?

I believe the only way is either to use flexbox and do whole sizing natively. @kmelmon can you comment on this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is somewhat complex to get right. Will take this offline to discuss.


In reply to: 391525771 [](ancestors = 391525771)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussing, I think all that's needed is to set flex:1 for both pane1 and pane2.


In reply to: 392512149 [](ancestors = 392512149,391525771)

Dimensions.removeEventListener('change', this._handleDimensionsChange);
}

_handleDimensionsChange = dimensions => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you dont need it since DualScreenInfo updating isSpanning automatically and you need only to subscribe there

Dimensions.removeEventListener('change', this._handleDimensionsChange);
}

_handleDimensionsChange = dimensions => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again - just use subscription to DualScreenInfo event

const children = React.Children.toArray(this.props.children);
if (children.length > 0) {
return (
<View key="pane1" style={{width:size.width, height:size.height}}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use only flexbox

}
}

renderSeparator() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is Hinge component for that

"react-native-vector-icons": "^6.6.0",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^2.0.16",
"react-native-windows": "^0.60.0-vnext.127"
Copy link
Contributor

@kmelmon kmelmon Mar 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"react-native-windows": "^0.60.0-vnext.127" [](start = 4, length = 43)

This isn't compatible with react-native 0.61.5. Does the windows sample actually work? If so I think you want to take a dependency on 0.61.0-beta.57 #Closed

@kmelmon
Copy link
Contributor

kmelmon commented Mar 13, 2020

return modules;

This file is generated by the build (in release mode) and shouldn't need to be checked in.


Refers to: twopaneview/examples/windows/DevDay2020KeynoteDemoReactNative/Bundle/index.windows.bundle:16 in 9a46c26. [](commit_id = 9a46c26, deletion_comment = False)


render() {

let direction ='row';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let direction ='row'; [](start = 4, length = 21)

There's no logic here to handle vertical orientation. Have you tested rotating the device to vertical?

}

renderSeparator() {
let horizontal = this.state.dims.width >= this.state.dims.height;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let horizontal = this.state.dims.width >= this.state.dims.height; [](start = 4, length = 65)

This isn't a reliable way to detect the orientation of the device. We can discuss offline.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right and personally I do not like this hack, but could not find a better way to detect this. Please, I am open to better suggestions if you now of a better way to detect orientation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can think of a couple ways to detect the orientation:

  1. It can be deduced from the windowRects coming from DualScreenInfo. If the device is horizontal, windowRects[1] will have a left that is != windowRects[0], and similarly if it's vertical, windowRects[1] will have a top that's != windowRects[0]. Of course there will only be two windowRects in the array when running on a dual-screen device, but this info should only be needed in that scenario.
  2. There's a community module called react-native-orientation. I think I would prefer option 1 to avoid another dependency, but I thought I should mention it.

You can fix this later BTW as what you have will work for all known devices at this point in time. If you decide to fix it later, just file an issue and we can track it.

@kmelmon
Copy link
Contributor

kmelmon commented Apr 9, 2020

in twopaneview/.npmignore, you'll want to add entries here, otherwise everything underneath the twopaneview directory will be published to npm. At the least you'd want to exclude the examples sub-directory. There may be others as well. #Closed


export class TwoPaneView extends Component<Props, State> {
state: State = {
dims: Dimensions.get('window'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dims: Dimensions.get('window'), [](start = 4, length = 31)

Discussed offline. There are still a bunch of changes needed, like to stop using Dimensions, which can be done as follow-up changes. Filed #9 to track.

Copy link
Collaborator Author

@HomeroRR HomeroRR Apr 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, eventually we would not need Dimensions. However, I am still having trouble getting the logic right with windowRects as exposed in DualScreenInfo

Copy link
Contributor

@kmelmon kmelmon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

const TPV_Orientation: PaneOrientationTypes = {
Horizontal: 'horizontal',
Vertical: 'vertical',
};
Copy link
Contributor

@kmelmon kmelmon Apr 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an expert on typescript, but it seems like this definition is unnecessary. I think what we want is to define this as an enum in the .ts file, and then use the type directly from within TwoPaneView code. This should allow us to remove TPV_Orientaiton altogether.

Same comment applies toTPV_PanePriority and PaneMode.
#Closed

Copy link
Collaborator Author

@HomeroRR HomeroRR Apr 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That actually makes so much more sense. Thanks for pointing that out! Just pushed the change. #Closed

Copy link
Contributor

@kmelmon kmelmon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

Copy link
Contributor

@kmelmon kmelmon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@HomeroRR HomeroRR requested a review from thewulf7 April 14, 2020 02:17
@HomeroRR HomeroRR merged commit ce64a60 into master Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants