Skip to content

Instantly share code, notes, and snippets.

@ianmartorell
ianmartorell / HoverState.ts
Last active August 25, 2021 16:32 — forked from necolas/Hoverable.js
Hover styles in React Native for Web
/* eslint-disable no-inner-declarations */
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
let isEnabled = false;
if (canUseDOM) {
/**
* Web browsers emulate mouse events (and hover states) after touch events.
* This code infers when the currently-in-use modality supports hover
* (including for multi-modality devices) and considers "hover" to be enabled
@necolas
necolas / Hoverable.js
Last active January 1, 2024 17:32
Hover styles in React Native for Web
import createHoverMonitor from './createHoverMonitor';
import { element, func, oneOfType } from 'prop-types';
import React, { Component } from 'react';
const hover = createHoverMonitor();
/**
* Use:
* <Hoverable>
* {(hover) => <View style={hover && styles.hovered} />}
<?php
$depth = 0;
echo '<ol class="tree">';
foreach ($children as $i => $child)
{
// Get the last and next nodes
$last = isset($children[$i-1]) ? $children[$i-1] : $children[0];
$next = isset($children[$i+1]) ? $children[$i+1] : $children[0];